package com.bayss.core;

import org.apache.commons.httpclient.HttpStatus;

public class DokoServerExceptionFactor {

    public static final DokoServerExceptionFactor DEFAULT = new DokoServerExceptionFactor(
            HttpStatus.SC_INTERNAL_SERVER_ERROR, 10001,
            "system error", "系统错误");
    public static final DokoServerExceptionFactor INTERNAL_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_INTERNAL_SERVER_ERROR, 10002,
            "internal server error", "内部错误");
    public static final DokoServerExceptionFactor BIND_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 10003,
            "bind param error", "系统参数绑定异常");
    public static final DokoServerExceptionFactor PATTERN_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 10004,
            "pattern error", "数据格式异常");
    public static final DokoServerExceptionFactor token_expire = new DokoServerExceptionFactor(
            HttpStatus.SC_OK, 10005,
            "pattern error", "token失效");
    public static final DokoServerExceptionFactor REQUEST_PARAM_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_INTERNAL_SERVER_ERROR, 10006,
            "pattern error", "非法参数");
    public static final DokoServerExceptionFactor PUSH_CONN_INTERRUPT = new DokoServerExceptionFactor(
            HttpStatus.SC_BAD_REQUEST, 20001,
            "connection is interrupted", "客户端连接中断");
    public static final DokoServerExceptionFactor PROTOCOL_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_BAD_REQUEST, 20002,
            "unsupport protocol", "不支持的协议");
    public static final DokoServerExceptionFactor MISSING_PARAM = new DokoServerExceptionFactor(
            HttpStatus.SC_BAD_REQUEST, 20003,
            "missing param", "缺少参数");
    public static final DokoServerExceptionFactor CONFIG_PARAM_TYPE_MISMATCH = new DokoServerExceptionFactor(
            HttpStatus.SC_BAD_REQUEST, 20010,
            "param type mismatch", "参数类型错误");
    public static final DokoServerExceptionFactor CONFIG_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 50000,
            "param config error", "参数校验配置出错");
    public static final DokoServerExceptionFactor PARAM_VERIFY_FAIL = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 50001,
            "invalid parameter", "参数数值错误");
    public static final DokoServerExceptionFactor CREATE_ORDER_FAIL = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 50010,
            "create order is fail", "创建订单失败");
    public static final DokoServerExceptionFactor PAY_FAIL = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 50011,
            "pay is fail", "支付失败");
    public static final DokoServerExceptionFactor USER_NOT_EXIST = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 50012,
            "user is not exist", "用户不存在");


    public static final DokoServerExceptionFactor SELF_SKU_COUNT_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 60001,
            "self sku count error", "自选餐选择规格错误");


    public static final DokoServerExceptionFactor SKU_INVENTORY_COUNT_ERROR = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 60002,
            "sku inventory count error", "餐品库存不足");


    public static final DokoServerExceptionFactor SELF_SKU_CLASSIFY_ITEM_MISS= new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 60003,
            "self sku classify item miss", "自选餐类目丢失，请重新进入");

    public static final DokoServerExceptionFactor ACTIVITY_APPLY_FAILED = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 80010,
            "activity apply failed", "活动申请失败");


    public static final DokoServerExceptionFactor ACTIVITY_APPLY_FAILED_BEYOND_LIMIT = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 80011,
            "activity apply failed beyond limit", "因为报名人数超过限制，活动申请失败");

    public static final DokoServerExceptionFactor ACTIVITY_APPLY_REPEAT= new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 80012,
            "activity apply repeat", "请勿重复申请");

    public static final DokoServerExceptionFactor ORDER_END = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 90001,
            "create order time is over", "订单时间已过");
    public static final DokoServerExceptionFactor ORDER_PAY_TIME_OUT = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 90002,
            "pay order time out time", "订单支付超时");
    public static final DokoServerExceptionFactor STATION_TIME_OUT = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 90003,
            "close the store for the night", "打烊了");
    public static final DokoServerExceptionFactor SEND_SMS_FAIL = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 90004,
            "send fail is fail", "短信发送失败");
    public static final DokoServerExceptionFactor VAIL_CODE_FAIL = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 90005,
            "vail code fail", "验证码失败");
    public static final DokoServerExceptionFactor BALANCE_FAIL = new DokoServerExceptionFactor(
            HttpStatus.SC_FORBIDDEN, 90006,
            "money is than", "余额不足");


    private int httpStatus;
    private int errorCode;
    private String errorMsg;
    private String errorMsgCN;

    public DokoServerExceptionFactor(int httpStatus, int errorCode, String errorMsg, String errorMsgCN) {
        this.httpStatus = httpStatus;
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.errorMsgCN = errorMsgCN;
    }

    public int getHttpStatus() {
        return httpStatus;
    }

    public void setHttpStatus(int httpStatus) {
        this.httpStatus = httpStatus;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getErrorMsgCN() {
        return errorMsgCN;
    }

    public void setErrorMsgCN(String errorMsgCN) {
        this.errorMsgCN = errorMsgCN;
    }
}
